package com.gzhryc.shared_device.oem.code.business.dao.db;

import com.gzhryc.jdbc.annotaion.Column;
import com.gzhryc.jdbc.annotaion.Join;
import com.gzhryc.jdbc.annotaion.PrimaryKey;
import com.gzhryc.jdbc.annotaion.Table;
import com.gzhryc.shared_device.oem.code.business.dao.enums.CouponActivityPlaceEnum;
import com.gzhryc.shared_device.oem.code.place.dao.db.PlacePhysicalStore;

import java.util.Date;

@Table(name = "business_coupon_activity_place")
public class CouponActivityPlace {

    @PrimaryKey
    @Column(name="activity_id",notNull = true)
    protected Long activityId;

    @PrimaryKey
    @Column(name="place_id",notNull = true)
    protected Long placeId;

    @Column(name = "coupon_count",notNull = true,defVal = "0",note = "优惠次数")
    protected Integer couponCount;

    @Column(notNull = true,defVal = "1",note = "状态")
    protected Integer state;

    @Column(name = "update_date", autoUpdateTime = true)
    protected Date updateDate;

    @Column(name = "create_date")
    protected Date createDate;

    @Join(fromField = "place_id")
    protected PlacePhysicalStore place;

    @Join(fromField = "activity_id")
    protected CouponActivity couponActivity;

    public Long getActivityId() {
        return activityId;
    }

    public void setActivityId(Long activityId) {
        this.activityId = activityId;
    }

    public Long getPlaceId() {
        return placeId;
    }

    public void setPlaceId(Long placeId) {
        this.placeId = placeId;
    }

    public Integer getCouponCount() {
        return couponCount;
    }

    public void setCouponCount(Integer couponCount) {
        this.couponCount = couponCount;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getStateName(){
        return CouponActivityPlaceEnum.State.note(this.state);
    }

    public PlacePhysicalStore getPlace() {
        return place;
    }

    public void setPlace(PlacePhysicalStore place) {
        this.place = place;
    }

    public CouponActivity getCouponActivity() {
        return couponActivity;
    }

    public void setCouponActivity(CouponActivity couponActivity) {
        this.couponActivity = couponActivity;
    }
}
